<script type="text/javascript"><!--//--><![CDATA[//><!--

	var grid_reload = function(){
		$('#datagrid').datagrid('reload', $('#fm_search').serializeObject());
	};


	$(document).ready(function() {
		// Setup Datagrid
		$('#datagrid').datagrid({  
			url:gs_path+'/'+controller+'/getdata', 
			queryParams: $('#fm_search').serializeObject(),
			height:340,
			pagination:true,
			columns:[[
				{ field : 'ck', checkbox:true, width: 40, align: 'center' },
				{ field : 'no_tagihan_tlp', title : 'Nomor tagihan', width : 200, sortable:true },
				{ field : 'nama_tenant', title : 'Nama Tenant', width : 250, sortable:true },
				{ field : 'atas_nama', title : 'Atas Nama', width : 250, sortable:true },
				{ field : 'tanggal_bayar', title : 'Tanggal Bayar', width : 150, sortable:true },
				{ field : 'periode_pembayaran', title : 'Periode Pembayaran', width : 150, sortable:true },
			]]
		});
	
		
	// Set Action Button
        var buttons = [  //print button
					    { label: 'Print PDF', icon: 'print', onclick: function() {
                                var oSel = $('#datagrid').datagrid('getSelected');
                            if (oSel == null) {
                                $.messager.alert('&nbsp;', gs_msg_row_unselected, 'warning'); 
                            } else {
                                window.open(gs_path+'/'+controller+'/cetak/?id_tagihan_tlp='+urlencode(oSel.id_tagihan_tlp), 'myWin', 'height=500,width=700,status=yes,toolbar=no,menubar=yes,location=no,scrollbars=yes');
                            } 

                        }}, { label: 'Print Satuan', icon: 'print', onclick: function() {
					    	var oSel = $('#datagrid').datagrid('getSelected');
					        if (oSel == null) {
					            $.messager.alert('&nbsp;', gs_msg_row_unselected, 'warning'); 
					        } else {
					    	window.location = gs_path + '/pro_print_excel_new/tagihan_telephone/?id_tagihan='+urlencode(oSel.id_tagihan_tlp);
					    	}
					    }},
					   ];
        setAction(buttons);
		
		
		$('#fm_search').focusFirst();
	});
//--><!]]></script>

<div id="tb" style="padding:5px;height:auto">
    <div>
        <form id="fm_search" onsubmit="grid_reload(); return false;">
        	<table class="tb_form" style="margin-bottom:0px">
            <tr>
            	<td width="100">Keyword</td>
                <td><input type="text" id="keyword" name="keyword" class="textfield medium" />
                	<a href="#" class="easyui-linkbutton" iconCls="icon-search" onclick="grid_reload(); return false;">Search</a>
                </td>
            </tr>
            </table>
        </form>
    </div>
</div>
<div id="datagrid" toolbar="#tb"></div>
